package org.crazyit.cloud;

import org.apache.cxf.helpers.IOUtils;
import org.apache.cxf.jaxrs.client.WebClient;

import javax.ws.rs.core.Response;
import java.io.IOException;
import java.io.InputStream;

public class CxfClient {

    public static void main(String[] args) throws IOException {
        //创建web client
        WebClient client = WebClient.create("http://127.0.0.1:8080/person/44");
        //获得响应
        Response response = client.get();
        //获取响应内容
        InputStream ent = (InputStream) response.getEntity();
        String content = IOUtils.readStringFromStream(ent);
        // 输出字符串
        System.out.println(content);


    }

}
